<%@ page language="java" import="java.util.*" pageEncoding="utf8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>数据库添加</title>

		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<script type="text/javascript">
			function setStyle(x)
			{
				document.getElementById(x).select();
			}
		</script>
		<style>
#thisform {
	font-family: Georgia, serif;
	font-size: 12px;
	color: #999;
}

#thisform label {
	font-family: Verdana, sans-serif;
	font-weight: bold;
	color: #660000;
}

#thisform fieldset {
	border: 1px solid #cc;
	padding: 0 20px;
}

#thisform legend {
	font-family: arial, sans-serif;
	font-weight: bold;
	font-size: 90%;
	color: #666;
	background: #eee;
	border: 1px solid #ccc;
	border-bottom-color: #999;
	border-right-color: #999;
	padding: 4px 8px;
}
</style>
	</head>
  
  <body>
		<form action="adddatabase.do" id="thisform" method="post">
			<fieldset>
				<legend>
					数据库添加
				</legend>
				<p><h2>${msg}</h2></p>
				<p>
					<label for="dbName">
						Database Name:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}"><input type="text" id="dbName" name="dbName" tabindex="1"></c:if>
					<c:if test="${mgrDatabase!=null}"><input type="text" id="dbName" name="dbName" tabindex="1" value="<c:out value='${mgrDatabase.dbName}' />"></c:if>
				</p>
				<p>
					<label for="databaseVersion">
						Database Version:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}"><input type="text" id="databaseVersion" name="databaseVersion" tabindex="2"></c:if>
					<c:if test="${mgrDatabase!=null}"><input type="text" id="databaseVersion" name="databaseVersion" tabindex="2" value="<c:out value='${mgrDatabase.databaseVersion}' />"></c:if>
				</p>
				<p>
					<label for="operationSystem">
						On which OS:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}">
					<select name="operationSystem" tabindex="3" id="operationSystem">
					  <option value="CentOS" selected="selected">CentOS</option>
					  <option value="Windows2003">Windows2003</option>
					  <option value="Windows2008">Windows2008</option>
					  <option value="HPUnix">HPUnix</option>
				    </select>
				    </c:if>
				    <c:if test="${mgrDatabase!=null}">
					<select name="operationSystem" tabindex="3" id="operationSystem">
					  <option value="CentOS" <c:if test='${mgrDatabase.operationSystem=="CentOS" }'>selected="selected"</c:if>>CentOS</option>
					  <option value="Windows2003" <c:if test='${mgrDatabase.operationSystem=="Windows2003" }'>selected="selected"</c:if>>Windows2003</option>
					  <option value="Windows2008" <c:if test='${mgrDatabase.operationSystem=="Windows2008" }'>selected="selected"</c:if>>Windows2008</option>
					  <option value="HPUnix" <c:if test='${mgrDatabase.operationSystem=="HPUnix" }'>selected="selected"</c:if>>HPUnix</option>
				    </select>
				    </c:if>
				</p>
				<p>
					<label for="dbPort">
						Port:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}"><input type="text" id="dbPort" name="dbPort" tabindex="4" value="3306" onfocus="setStyle(this.id)"></c:if>
					<c:if test="${mgrDatabase!=null}"><input type="text" id="dbPort" name="dbPort" tabindex="4" onfocus="setStyle(this.id)" value="<c:out value='${mgrDatabase.dbPort}' />"></c:if>
				</p>
				<p>
					<label for="dbEngine">
						Engine:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}">
					<select name="dbEngine" tabindex="5" id="dbEngine">
					  <option value="Innodb" selected="selected">Innodb</option>
					  <option value="MyISAM" >MyISAM</option>
					  <option value="MEMORY" >MEMORY</option>
					  <option value="FEDERATED" >FEDERATED</option>
					  <option value="ARCHIVE" >ARCHIVE</option>
					  <option value="CSV" >CSV</option>
				    </select>
				    </c:if>
					<c:if test="${mgrDatabase!=null}">
					<select name="dbEngine" tabindex="5" id="dbEngine">
					  <option value="Innodb" <c:if test='${mgrDatabase.dbEngine=="Innodb"}'>selected="selected"</c:if>>Innodb</option>
					  <option value="MyISAM" <c:if test='${mgrDatabase.dbEngine=="MyISAM"}'>selected="selected"</c:if>>MyISAM</option>
					  <option value="MEMORY" <c:if test='${mgrDatabase.dbEngine=="MEMORY"}'>selected="selected"</c:if>>MEMORY</option>
					  <option value="FEDERATED" <c:if test='${mgrDatabase.dbEngine=="FEDERATED"}'>selected="selected"</c:if>>FEDERATED</option>
					  <option value="ARCHIVE" <c:if test='${mgrDatabase.dbEngine=="ARCHIVE"}'>selected="selected"</c:if>>ARCHIVE</option>
					  <option value="CSV" <c:if test='${mgrDatabase.dbEngine=="CSV"}'>selected="selected"</c:if>>CSV</option>
				    </select>
				    </c:if>
				</p>
				<p>
					<label for="dbCharacterSet">
						CharacterSet:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}"><input type="text" id="dbCharacterSet" name="dbCharacterSet" tabindex="6" value="UTF8" onfocus="setStyle(this.id)"></c:if>
					<c:if test="${mgrDatabase!=null}"><input type="text" id="dbCharacterSet" name="dbCharacterSet" tabindex="6" onfocus="setStyle(this.id)" value="<c:out value='${mgrDatabase.dbCharacterSet}' />"></c:if>
				</p>
				<p>
					<label for="isMaster">
						Is this a Master:
					</label>
					<br />
					 <label>
					 <c:if test="${mgrDatabase==null}"><input type="radio" name="isMaster" value="true" tabindex="7" checked="checked">Master</c:if>
					 <c:if test="${mgrDatabase!=null}"><input type="radio" name="isMaster" value="true" tabindex="7" <c:if test="${mgrDatabase.isMaster}">checked="checked"</c:if> />Master</c:if>
				    </label>
			        <label>
			        <c:if test="${mgrDatabase==null}"><input type="radio" name="isMaster" value="false" tabindex="8">Slave</c:if>
					 <c:if test="${mgrDatabase!=null}"><input type="radio" name="isMaster" value="false" tabindex="8" <c:if test="${!mgrDatabase.isMaster}">checked="checked"</c:if> />Slave</c:if>
			        </label>
				</p>
				<p>
					<label for="projectName" accesskey="9">
						Belongs to which project:
					</label>
					<br />
					<c:if test="${mgrDatabase==null}"><input type="text" id="projectName" name="projectName" tabindex="9"></c:if>
					<c:if test="${mgrDatabase!=null}"><input type="text" id="projectName" name="projectName" tabindex="9" value="<c:out value='${mgrDatabase.projectName}' />"></c:if>
				</p>
				<p>
					<label for="applyPerson">
						Who apply this:
					</label>
					<br />
					<input type="text" id="applyPerson" name="applyPerson" tabindex="10" value="<c:if test='${mgrDatabase!=null}'><c:out value='${mgrDatabase.applyPerson}' /></c:if>" />
				</p>
				<p>
					<label for="tableCount">
						How many tables:
					</label>
					<br />
					<input type="text" id="tableCount" name="tableCount" tabindex="11" value="<c:if test='${mgrDatabase!=null}'><c:out value='${mgrDatabase.tableCount}' /></c:if>" />
				</p>
				<p>
					<label for="usePartition">
						Use partition:
					</label>
					<br />
					 <label>
				   	<c:if test="${mgrDatabase==null}"><input type="radio" name="usePartition" value="true" tabindex="13" />Yes</c:if>
			        <c:if test="${mgrDatabase!=null}"><input type="radio" name="usePartition" value="true" tabindex="13" <c:if test='${mgrDatabase.usePartition}'>checked="checked"</c:if> />Yes</c:if>
				   </label>
			        <label>
			        <c:if test="${mgrDatabase==null}"><input type="radio" name="usePartition" value="false" tabindex="13" checked="checked" />No</c:if>
			        <c:if test="${mgrDatabase!=null}"><input type="radio" name="usePartition" value="false" tabindex="13" <c:if test='${!mgrDatabase.usePartition}'>checked="checked"</c:if> />No</c:if>
			        </label>
				</p>
				<p>
					<input type="hidden" value="" name="masterId">
					<input type="hidden" value="<c:if test='${mgrDatabase!=null}'><c:out value='${mgrDatabase.id}'/></c:if>" name="id">
					<input type="hidden" value="${machineId}" name="machineId">
					<input type="submit" value="submit" tabindex="14" />
					<input type="button" value="cancel" tabindex="15" onclick="window.location.href='redirect.do?method=welcome'"/>
				</p>
			</fieldset>
		</form>
	</body>
</html>
